<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
  <head>
    <title>index.html</title>
	<link rel="stylesheet" href="${pageContext.request.contextPath}/back/css/btn.css" />
    <meta name="keywords" content="keyword1,keyword2,keyword3">
    <meta name="description" content="this is my page">
    <meta name="content-type" content="text/html; charset=GBK">
    <script type="text/javascript" src="${pageContext.request.contextPath}/back/js/jquery-3.3.1.js"></script>
  </head>
  
  <body style="background-color: #f0f9fd;text-align: center">
    <%--<div style="color:red;">${param.message}</div>--%>
  	<div style="text-align: center;font-size: 18px">添加商品类别</div><hr/>
  	<form action="${pageContext.request.contextPath}/category/addCategoryLevels1" method="post">
  		类别名:<input class="el-input__inner" type="text" name="categoryName" id="fname"/>
        <span id="fnameMsg"></span><br/><br/>
  		<input class="button btn-p" type="submit" value="提交">&emsp;
		<div class="button btn-p"  onclick="history.go(-1);">返回上级</div>
  	</form>

    <script>
        var a='${param.message}';
        if(a!=null&&a.length>0){
            alert('${param.message}');
        }
        $(function () {
            $("#fname").blur(checkCategoryName);
            $("form").submit(checkSubmit);
        });
        function checkSubmit() {
            var r1=checkCategoryName();
            return r1;
        }
        function checkCategoryName() {
            if ( $("#fname").val().trim().length<=0){
                $("#fnameMsg").html("一级类别名为必填项").css("color","red");
                return false;
            }else {
                $("#fnameMsg").html("");
                return true;
            }
        }
    </script>
  </body>
</html>
